<?php

use Biz\pockets\constInterface\SourceRightsInterface;
use Biz\service\brand\BrandShop;
use Biz\service\BrandRights\BrandEquityVerificationService;
use Doraemon\tools\ActionLog;


class shopListAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_NOTHING;

    public function main()
    {
        $brand_id = $this->getRequest()->getPost('brand_id', 0);
        $location = $this->getRequest()->getPost('location') ?: '';
        //判断门店权益
        $res = BrandEquityVerificationService::checkOneSourceStatus($brand_id, SourceRightsInterface::STORE, true);
        ActionLog::log($this->uid, ['brand_id' => $brand_id], ActionLog::BRADN_DETAIL_SHOP_INFO);
        $return['list'] = [];
        if ($res) {
            $list = BrandShop::getShopList($location, $brand_id) ?: [];
            $return['list'] = array_values($list) ? : [];
        }
        $this->setSuccess($return);
    }

}